﻿@using LibraryHub.Core.Models.Book
@model IndexModel

@{
    ViewBag.Title = "Список книг";
}

<h2>@ViewBag.Title</h2>

<p>
    @Html.ActionLink("Добавить новую книгу", "Create")
</p>
<table>
    <tr>
        <th></th>
        <th>
            Название
        </th>
        <th>
            Описание
        </th>
        <th></th>
    </tr>

@foreach (var item in Model.Books) {
    <tr>
        <td>
            @if (item.IsTaken)
            {
                <text>X</text>
            }
        </td>
        <td>
            @Html.ActionLink(@Html.DisplayFor(modelItem => item.Title).ToHtmlString(), "Details", new { id = item.Id })
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Description)
        </td>
        <td>
            @Html.ActionLink("Редактировать", "Edit", new { id=item.Id }) |
            @Html.ActionLink("Удалить", "Delete", new { id=item.Id })
        </td>
    </tr>
}

</table>
